import { request } from '../utils/request.js'
import store from '../store'
import md5 from 'js-md5'
import { Toast, Jump } from '../utils/tools.js'
import { UserInfo,balance } from "@/api/Users.js"
// 创建实名 订单
export async function BindIdcardFn(params) {
	try {
		let res = await request({
			url: '/Payment/BindIdcard',
			method: "post",
			params
		})
		if (res.success) {
			await UserInfo()
		}
		return res
	} catch (e) {
		return false
	}
}

//合伙人 当前数量
export async function hhrTotalCount(params) {
	try {
		let res = await request({
			url: '/Payment/hhrTotalCount',
			method: "post",
			params
		})
		return res
	} catch (e) {
		return false
	}
}
//成为合伙人合伙人
export async function hhrApply(params) {
	try {
		let res = await request({
			url: '/Payment/hhrApply',
			method: "post",
			params
		})
		if (res.success) {
			await UserInfo()
		}
		return res
	} catch (e) {
		return false
	}
}

//创建 充值 订单
export async function Recharge(params) {
	try {
		// params.paypassword = md5(params.paypassword);
		let res = await request({
			url: '/Payment/Recharge',
			method: "post",
			params
		})
		// if (res.success) {
		// 	await UserInfo()
		// }
		return res
	} catch (e) {
		return false
	}
}

export async function GetPayment(params) {
	try {
		let res = await request({
			url: '/Payment/GetPayment',
			method: "post",
			params
		})
		return res
	} catch (e) {
		return false
	}
}

export async function myShoPaymentQrcode(params) {
	try {
		let res = await request({
			url: '/Payment/myShoPaymentQrcode',
			method: "post",
			params
		})
		return res
	} catch (e) {
		return false
	}
}

export async function shoPyament(params) {
	try {
		let res = await request({
			url: '/Payment/shoPyament',
			method: "post",
			params
		})
		if(res.success){
			await balance()
		}
		return res
	} catch (e) {
		return false
	}
}
